package com.majun.listener;

import com.alibaba.fastjson.JSON;
import com.majun.bean.SysUserDto;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 监听消费同步发送的消息
 *
 * @author zy
 * @date 2020/6/12
 * @since 1.0.0
 */
@Slf4j
@Component
@RocketMQMessageListener(consumerGroup = "sync-consumer", topic = "sync-message")
public class SyncMessageListener implements RocketMQListener<SysUserDto> {
    @Override
    public void onMessage(SysUserDto sysUserDto) {
        log.info("消费到了同步消息: message = {}", JSON.toJSONString(sysUserDto));
    }
}
